package jjn.effective_java.chapter6.item38;

/**
 * @author Jiang Jining
 * @since 2023-04-29 11:06
 */
public class MathTest {
    public static void main(String[] args) {
        System.out.println("BasicOperation.PLUS.apply(1.0, 2.0) = " + BasicOperation.PLUS.apply(10.0, 2.0));
        System.out.println("BasicOperation.MINUS.apply(1.0, 2.0) = " + BasicOperation.MINUS.apply(10.0, 2.0));
        System.out.println("BasicOperation.TIMES.apply(1.0, 2.0) = " + BasicOperation.TIMES.apply(10.0, 2.0));
        System.out.println("BasicOperation.DIVIDE.apply(1.0, 2.0) = " + BasicOperation.DIVIDE.apply(10.0, 2.0));
        System.out.println("ExtendedOperation.EXP.apply(1.0, 2.0) = " + ExtendedOperation.EXP.apply(10.0, 2.0));
        System.out.println("ExtendedOperation.REMAINDER.apply(1.0, 2.0) = " + ExtendedOperation.REMAINDER.apply(10.0, 2.0));
        
        Operation[] basicOperations = BasicOperation.values();
        for (Operation operation : basicOperations) {
            String name = operation.toString();
            System.out.println("operation name = " + name);
            System.out.println("operation.apply(10.0, 2.0) = " + operation.apply(10.0, 2.0));
        }
        
        Operation[] extendedOperations = ExtendedOperation.values();
        for (Operation operation : extendedOperations) {
            String name = operation.toString();
            System.out.println("operation name = " + name);
            System.out.println("operation.apply(10.0, 2.0) = " + operation.apply(10.0, 2.0));
        }
    }
}
